#include "proto/message.pb.h"
#include <string>

int main()
{
	std::string str;
	int len;
	char buffer[1024];
	proto::AccountRequest registerRequest;
	registerRequest.set_password("XX1516305754");
	registerRequest.set_username("lvqiang");
	registerRequest.SerializeToString(&str);
	std::cout << str.size() << std::endl;
	len = str.size();
	::memcpy(buffer, &len, sizeof(len));
	::memcpy(buffer + 4, str.c_str(), len);
	int delen;
	memcpy(&delen, buffer, sizeof(delen));
	proto::AccountRequest deregisterRequest;
	deregisterRequest.ParseFromArray(buffer + 4, delen);
	std::cout << deregisterRequest.username() << " " << deregisterRequest.password() << std::endl;
}